#include <iostream>
#include <time.h>
#include "tContainer_t.h"

using namespace std;

int RandomInt(int from , int to) {              // return random integer between [from-to] 
	  int rnd = from + rand()%(to-from+1);
	  return rnd;
}

int main() {
	typedef int  type;
	typedef list<type*> containerType;

	srand(time(NULL));
	tContainer_t<type,containerType> t;
	tContainer_t<type,containerType> t1;
	
	int *q;

	cout << "hi" << endl;
	cout << "container is " << (t.isEmpty() ? "empty" : "not empty")  << endl;
	
	
	int a = 0;
	int b = 1;
	int c = 2;
	
	t.insertNewElement(&a);
	t.insertNewElement(&b);
	t.insertNewElement(&c);
	

	t1.insertNewElement(&a);
	t1.insertNewElement(&b);
	t1.insertNewElement(&c);
	
	
	cout << "The first element is: "<< *t.getFirstElement() << endl;
	cout << "The last  element is: "<< *t.getLastElement() << endl;
	
	


	cout<<"we insert "<<t.numberOfElements()<<" elements"<<endl;
	
	
	cout << "container is " << (t.isEmpty() ? "empty" : "not empty")  << endl;
		
	cout <<"This is the container values:"<<endl;
	
	for (int i=0; i < t.numberOfElements();i++){
		q = t[i];
		if (q!=0) {
			cout << "The element at index "<<i<< " is "<< *q << endl;
		}
	}

	for (int i=0; i < t.numberOfElements();i++){
		cout<<"We are looking for value number "<<i<<endl;
		 q = t.findByValue(i);
		 if (q!=0) {
			cout << "we found number: " << *q << endl;
		}
	}

	t+=t1;

	cout<<"after merging this is the container values:"<<endl;
	
	for (int i=0; i < t.numberOfElements();i++){
		 cout << "In index " <<i<<" the value is: " <<*t[i] << endl;
	}
	return 0;
}
